home *** CD-ROM | disk | FTP | other *** search
- /*
- * wintext.h
- *
- * Routines for font-independent window-text system, which allows
- * writing of text based on character positions.
- * Still being tweaked.
- *
- * MWS 3/92.
- */
-
- #include <exec/types.h>
- #include <graphics/gfxmacros.h>
- #include <graphics/gfxbase.h>
- #include <intuition/intuition.h>
- #include <proto/graphics.h>
- #include <proto/intuition.h>
-
- #include <string.h>
-
- #include "wintext.h"
-
- BOOL
- InitWinTextInfo(WINTEXTINFO * wti) /* for Workbench screen at moment */
- {
- struct Screen screen;
- struct TextFont *tf;
-
- if (GetScreenData(&screen, sizeof(screen), WBENCHSCREEN, NULL))
- {
- wti->tattr.ta_Name = GfxBase->DefaultFont->tf_Message.mn_Node.ln_Name;
- wti->tattr.ta_YSize = GfxBase->DefaultFont->tf_YSize;
-
- if (tf = OpenFont(&wti->tattr)) /* have a peek */
- {
- wti->font_x = tf->tf_XSize;
- wti->font_y = tf->tf_YSize;
- wti->font_baseline = tf->tf_Baseline;
- /* no dragbar, so modified toffset */
- wti->toffset = screen.WBorTop + 1/*+ tf->tf_YSize*/;
- wti->loffset = screen.WBorLeft + 2;
- wti->roffset = screen.WBorRight + 2;
- wti->boffset = screen.WBorBottom;
-
- CloseFont(tf); /* should be set to rastport of window */
- return TRUE;
- }
- }
- return FALSE;
- }
-
- /****** UNUSED AT MOMENT
- void RenderWinTexts(WINTEXTINFO *info, WINTEXT *wt)
- {
- struct RastPort *rp;
-
- while (wt)
- {
- rp = info->window->RPort;
- SetAPen(rp, wt->pen);
- SetDrMd(rp, wt->mode);
- Move(rp, info->loffset + wt->lpos*info->font_x,
- info->toffset + wt->tpos*info->font_y + info->font_baseline);
- Text(rp, wt->text, strlen(wt->text));
- wt = wt->next;
- }
- }
- ******/
-
-
- void
- WinText(WINTEXTINFO * info, char *text,
- UWORD lpos, UWORD tpos, UWORD pen, UWORD mode)
- {
- struct RastPort *rp;
-
- rp = info->window->RPort;
- SetAPen(rp, pen);
- SetDrMd(rp, mode);
- Move(rp, info->loffset + lpos * info->font_x,
- info->toffset + tpos * info->font_y + info->font_baseline);
- Text(rp, text, strlen(text));
- }
-